/**
 * @Author：ming
 * @Date：2023/10/29 11:39 PM
 * @Filename：Hot226
 */

/**
 * @author ming
 */
public class Hot226 {
    public TreeNode invertTree(TreeNode root) {
        if(root==null){
            return null;
        }

        invertTree(root.left);
        invertTree(root.right);
        TreeNode left = root.left;
        TreeNode right = root.right;
        root.left = right;
        root.right = left;


        return root;
    }
}
